
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.model.WeakProblem"%>
<%@page import="com.shsh.safemanage.model.WeakReport"%>
<%@page import="com.shsh.safemanage.model.WeakUserReport"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%
{
	WeakReport theWeakReport = (WeakReport)session.getAttribute(Constants.SESSION_WEAK_REPORT);
%>

<table border="1" width="99%" style="align:center; margin-left: 6px">
	<tr>
		<td rowspan="2" style="text-align:center;width:6%;" class="td3">
		姓名
		</td>
		<td rowspan="2" style="text-align:center;width:3%;" class="td3">
		序号
		</td>
		<td rowspan="2" style="text-align:center;width:22%;" class="td3">
		薄弱环节描述
		</td>
		<td rowspan="2" style="text-align:center;width:20%;" class="td3">
		改进对策与措施
		</td>
		<td rowspan="2" style="text-align:center;width:12%;" class="td3">
		薄弱环节分类
		</td>
		<td rowspan="2" style="text-align:center;width:5%;" class="td3">
		积分
		</td>
		<td colspan="2" style="text-align:center;width:15%;" class="td3">
		备注
		</td>
		<td rowspan="2" style="text-align:center;width:5%;" class="td3">
		累计积分
		</td>
		<td rowspan="2" style="text-align:center;" class="td3">
		操作
		</td>
	</tr>
	<tr>
		<td style="text-align:center;width:5%;" class="td3">
		扣分值
		</td>
		<td style="text-align:center;width:10%;" class="td3">
		8:00--16:30以外时间
		</td>
	</tr>
<%
List<WeakUserReport> userReportList=null;

if(theWeakReport.getReportType() == Constants.WEAK_REPORT_TYPE_YIXIANYUANGONG) {
	userReportList=theWeakReport.getYixianReportList();
} else if(theWeakReport.getReportType() == Constants.WEAK_REPORT_TYPE_GUANLIRENYUAN){
	userReportList=theWeakReport.getGuanliReportList();
}


for(int index = 0; index < userReportList.size(); index++) {
	WeakUserReport userReport = userReportList.get(index);
	User user = theWeakReport.getUserMap().get(userReport.getUserID());
	int size = userReport.getProblemList().size();
	int pointSum = userReport.getPointSum();
	boolean isFirstRow = true;
%>
<%
	for(int index2=0;index2<userReport.getProblemList().size();index2++) {
		WeakProblem p =  userReport.getProblemList().get(index2);
		boolean canCheckWeakType = false;
		boolean displayRedPoint = false;
		if(p.getProblemType()==null || p.getGrade()==null || p.getGrade()==0){
			canCheckWeakType=true;
		}
		if(p.getWeakType()!=2 || p.hasNoneWorkTime()){
			displayRedPoint = true;
		}
		if(isFirstRow) {
%>
	<tr>
		<td rowspan="<%=size%>" style="text-align:center;">
		<%=Util.getDisplay(user.getName(), "&nbsp;") %>
		</td>
<%
		}
%>
		<td style="text-align:center;<%=p.isNeedDelete()?"background:gray;":""%>">
		<%=index2+1 %>
		</td>
		<td style="text-align:left;padding-left:5px;<%=p.isNeedDelete()?"background:gray;":""%>">
		<%=Util.getDisplay(p.getProblemContent(), "&nbsp;") %>
		</td>
		<td style="text-align:left;padding-left:5px;<%=p.isNeedDelete()?"background:gray;":""%>">
		<%=Util.getDisplay(p.getProblemZhenggai(), "&nbsp;") %>
		</td>
		<td style="text-align:center;<%=canCheckWeakType?"":"background-color:gray;" %><%=p.isNeedDelete()?"background:gray;":""%>">
			<input <%=canCheckWeakType?"":"disabled=\"disabled\"" %> type="checkbox" id="weakType<%=p.getId()%>_0" name="weakType<%=p.getId()%>_0" onclick="checkWeakType(<%=p.getId()%>, 0)" <%=p.getWeakType()==0?"checked=\"checked\"":"" %> value="0"/><label for="weakType<%=p.getId()%>_0">A</label>
			<input <%=canCheckWeakType?"":"disabled=\"disabled\"" %> type="checkbox" id="weakType<%=p.getId()%>_1" name="weakType<%=p.getId()%>_1" onclick="checkWeakType(<%=p.getId()%>, 1)" <%=p.getWeakType()==1?"checked=\"checked\"":"" %> value="1"/><label for="weakType<%=p.getId()%>_1">B</label>
			<input <%=canCheckWeakType?"":"disabled=\"disabled\"" %> type="checkbox" id="weakType<%=p.getId()%>_2" name="weakType<%=p.getId()%>_2" onclick="checkWeakType(<%=p.getId()%>, 2)" <%=p.getWeakType()==2?"checked=\"checked\"":"" %> value="2"/><label for="weakType<%=p.getId()%>_2">C</label>
		</td>
		<td style="text-align:center;<%=displayRedPoint?"color:red;":""%><%=p.isNeedDelete()?"background:gray;":""%>">
		<%=Util.getDisplay(Util.formatGrade(p.getPoint()), "&nbsp;") %>
		</td>
		<td style="text-align:center;<%=p.isNeedDelete()?"background:gray;":""%>">
		<%=Util.getDisplay(p.getGrade()==null?null:Util.formatGrade(p.getGrade()), "&nbsp;") %>
		</td>
		<td style="text-align:left;<%=p.isNeedDelete()?"background:gray;":""%>">
		<input type="checkbox" id="noneWorkTimeCheck<%=p.getId()%>" name="noneWorkTimeCheck<%=p.getId()%>" onclick="checkNoneWorkTime(<%=p.getId()%>)" <%=p.hasNoneWorkTime()?"checked=\"checked\"":"" %> value=""/>
		<input type="text" id="noneWorkTimeValue<%=p.getId()%>" name="noneWorkTimeValue<%=p.getId()%>" style="width:50px;" value="<%=Util.getDisplay(p.getNoneWorkTime(), "") %>"/>
		</td>
<%
		if(isFirstRow) {
%>
		<td rowspan="<%=size%>" style="text-align:center;">
		<%=Util.getDisplay(Util.formatGrade(pointSum), "&nbsp;") %>
		</td>
<%
		}
%>
		<td style="text-align:center;<%=p.isNeedDelete()?"background:gray;":""%>">
		<input type="checkbox" id="delete<%=p.getId()%>" name="delete<%=p.getId()%>" onclick="checkDelete(<%=p.getId()%>)" <%=p.isNeedDelete()?"checked=\"checked\"":"" %> value=""/><label for="delete<%=p.getId()%>">删除</label>
		</td>
	</tr>
<%
		isFirstRow = false;
	}
}
%>
<%
	for(int index3=0;index3<theWeakReport.getNeedDeleteList().size();index3++) {
		WeakProblem p =  theWeakReport.getNeedDeleteList().get(index3);
		boolean canCheckWeakType = false;
		boolean displayRedPoint = false;
		User user = theWeakReport.getUserMap().get(p.getWriteUserID());
		if(!p.isNeedDelete()) {
			canCheckWeakType = true;
		}

		if(p.getWeakType()!=2 || p.hasNoneWorkTime()){
			displayRedPoint = true;
		}	
%>
	<tr style="background:gray;">
		<td style="text-align:center;">
		<%=Util.getDisplay(user.getName(), "&nbsp;") %>
		</td>
		<td style="text-align:center;">
		<%=index3+1 %>
		</td>
		<td style="text-align:left;padding-left:5px;">
		<%=Util.getDisplay(p.getProblemContent(), "&nbsp;") %>
		</td>
		<td style="text-align:left;padding-left:5px;">
		<%=Util.getDisplay(p.getProblemZhenggai(), "&nbsp;") %>
		</td>
		<td style="text-align:center;<%=canCheckWeakType?"":"background-color:gray;" %><%=p.isNeedDelete()?"background:gray;":""%>">
			<input <%=canCheckWeakType?"":"disabled=\"disabled\"" %> type="checkbox" id="weakType<%=p.getId()%>_0" name="weakType<%=p.getId()%>_0" onclick="checkWeakType(<%=p.getId()%>, 0)" <%=p.getWeakType()==0?"checked=\"checked\"":"" %> value="0"/><label for="weakType<%=p.getId()%>_0">A</label>
			<input <%=canCheckWeakType?"":"disabled=\"disabled\"" %> type="checkbox" id="weakType<%=p.getId()%>_1" name="weakType<%=p.getId()%>_1" onclick="checkWeakType(<%=p.getId()%>, 1)" <%=p.getWeakType()==1?"checked=\"checked\"":"" %> value="1"/><label for="weakType<%=p.getId()%>_1">B</label>
			<input <%=canCheckWeakType?"":"disabled=\"disabled\"" %> type="checkbox" id="weakType<%=p.getId()%>_2" name="weakType<%=p.getId()%>_2" onclick="checkWeakType(<%=p.getId()%>, 2)" <%=p.getWeakType()==2?"checked=\"checked\"":"" %> value="2"/><label for="weakType<%=p.getId()%>_2">C</label>
		</td>
		<td style="text-align:center;<%=displayRedPoint?"color:red;":""%>">
		<%=Util.getDisplay(Util.formatGrade(p.getPoint()), "&nbsp;") %>
		</td>
		<td style="text-align:center;">
		<%=Util.getDisplay(p.getGrade()==null?null:Util.formatGrade(p.getGrade()), "&nbsp;") %>
		</td>
		<td style="text-align:left;">
		<input type="checkbox" id="noneWorkTimeCheck<%=p.getId()%>" name="noneWorkTimeCheck<%=p.getId()%>" onclick="checkNoneWorkTime(<%=p.getId()%>)" <%=p.hasNoneWorkTime()?"checked=\"checked\"":"" %> value=""/>
		<input type="text" id="noneWorkTimeValue<%=p.getId()%>" name="noneWorkTimeValue<%=p.getId()%>" style="width:50px;" value="<%=Util.getDisplay(p.getNoneWorkTime(), "") %>"/>
		</td>
		<td style="text-align:center;">
		&nbsp;
		</td>
		<td style="text-align:center;">
			<input type="checkbox" id="delete<%=p.getId()%>" name="delete<%=p.getId()%>" onclick="checkDelete(<%=p.getId()%>)" <%=p.isNeedDelete()?"checked=\"checked\"":"" %> value=""/><label for="delete<%=p.getId()%>">删除</label>
			<input type="checkbox" id="reverse<%=p.getId()%>" name="reverse<%=p.getId()%>" onclick="checkReverse(<%=p.getId()%>)" <%=!p.isNeedDelete()?"checked=\"checked\"":"" %> value=""/><label for="reverse<%=p.getId()%>">还原</label>
		</td>
	</tr>
<%
	
	}
%>
<%
if(theWeakReport.getReportType() == Constants.WEAK_REPORT_TYPE_YIXIANYUANGONG) {
	ProblemDao theProblemDao1 = DaoCreator.createProblemDao();
	Problem theProblem = theProblemDao1.getProblemByID(theWeakReport.getProblemID());
%>
	<tr>
		<td colspan="2" style="text-align:center;">
		汇总人及日期
		</td>
		<td  style="text-align:center;">
		<%=Util.getDisplay(theProblem==null?null:theProblem.getWriteUserName(), "&nbsp;") %>&nbsp;&nbsp;
		<%=Util.getDisplay(theProblem==null?null:Util.formatDate(theProblem.getWriteTime()), "&nbsp;") %>
		</td>
		<td colspan="7">
		&nbsp;
		</td>
	</tr>
<%
}
%>
	<tr>
		<td class="td1" colspan="10" >
				<span style="margin-left: 30px; font-weight: bold">反馈信息：</span>
				<br />
				<div id="feedbackProcessMethodDiv">
				<%@include file="/weak/write_report_method.jsp" %>
				</div>				
			</td>
	</tr>
		<tr>
			<td class="td1" height="35" colspan="10">
				<input type="button" style="margin-left: 330px" value="提 交" onclick="feedbackWeakReport()" />
				<input type="button" style="margin-left: 30px" value="取 消" onclick="cancelFeedback()" />
			</td>
		</tr>
</table>
<%
}
%>